﻿<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>PasteSpider-用户登录-基础版</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style>
        html,
        body {
            margin: 0;
            height: 100%;
            width: 100%;
        }
        .loginpage{
            width:100%;
            height: 100%;
        }

        .loginarea {
            width: 100%;
            max-width: 500px;
            box-shadow: 0 0 2px 2px #e3e3e3;
            box-sizing: border-box;
            border-radius: 12px;
            position: relative;
            margin: auto;
            padding: 20px;
            padding-top: 50px;
            padding-bottom: 50px;
            top:50%;
            margin-top:-300px;

        }

        .loginarea .row {

            position: relative;
            margin-bottom: 30px;
        }

        .loginarea input[type=text],
        input[type=password] {
            line-height: 48px;
            outline: none;
            border: 1px solid #e3e3e3;
            width: 100%;
            padding-left: 10px;
            padding-right: 10px;
            border-radius: 8px;
            box-sizing: border-box;
            transition: all 0.5s;
        }

        .loginarea input[type=text]:hover,
        input[type=password]:hover {
            border: 1px solid #b95b5b;
        }

        .loginarea input[type=button] {
            line-height: 48px;
            outline: none;
            border: 1px solid #e3e3e3;
            width: 100%;
            padding-left: 10px;
            padding-right: 10px;
            border-radius: 8px;
            box-sizing: border-box;
            background-color: #5eb95e;
            color: white;
            cursor: pointer;
        }

        .loginarea input[type=button]:hover {
            background-color: #c81623;
        }


        .footerarea {
            height: 46px;
            line-height: 46px;
            bottom: 0;
            text-align: center;
            color: #b3b3b3;
            font-size: 12px;
            position: absolute;
            left: 0;
            right: 0;
            width: 100%;
            z-index: 99;
            border-top: 1px solid #a7a7a7;
            padding: 15px 0;
            font-family: tahoma, Arial;
        }

        .imgcode{
            display: inline-block;
            height: 48px;
            width: 177px;
            font-size: 0;
            text-align: left;
            vertical-align: middle;
            cursor: pointer;
        }
        .inputcode{
            display:inline-block;
            width:60% !important;
        }

    </style>
</head>

<body>
    <div class="loginpage">
        <div id="loginform" class="loginarea">
            <form class="form form-horizontal" id="fromlogin">
                <div class="row cl">
                    <div class="divtitle">
                        <input name="account" type="text" placeholder="账户" class="input-text size-L inputaccount">
                    </div>
                </div>
                <div class="row cl">
                    <div class="divtitle">
                        <input name="password" type="password" placeholder="密码" class="input-text size-L inputpass">
                    </div>
                </div>

                <div class="row cl" style="display:none;">
                    <div class="divtitle">
                        <input name="guid" type="text" placeholder="串号" class="input-text size-L">
                    </div>
                </div>

                <div class="row cl">
                    <div class="divtitle">
                        <img class="imgcode">
                        <input type="text" name="code" class="inputcode" placeholder="输入图形码">
                    </div>
                </div>

                <div class="row cl">
                    <div class="divtitle col-xs-offset-3">
                        <input type="button" onclick="_funclogin()"
                            value="&nbsp;&nbsp;&nbsp;登&nbsp;&nbsp;&nbsp;陆&nbsp;&nbsp;&nbsp;"
                            class="btn btn-success radius size-L">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="footerarea">Copyright soft.pastecode.cn PasteSpider @2022</div>
    <script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/api.js"></script>
    <script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>

    <script type="text/javascript">


        var gameid = 0;

        function randomString(len) {
            len = len || 32;
            var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
            var maxPos = $chars.length;
            var pwd = '';
            for (i = 0; i < len; i++) {
                pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
            }
            return pwd;
        }

        var tguid = "";
        $(window).ready(function () {

            _loadImage();
            $(".imgcode").on('click',function(){
                _loadImage();
            });

        });
        function _loadImage(){
            var guid =randomString(16);
            $("[name=guid]").val(guid);
            $(".imgcode").attr("src","/api/spider/user/Image?guid="+guid);
            $("[name=code]").val('');
        }

        function _funclogin() {

            var dataobj = $("#fromlogin").parseForm();
            if (dataobj.account.length == 0) {
                layer.msg("账号不能为空");
                return;
            }
            if (dataobj.password.length == 0) {
                layer.msg("密码不能为空");
                return;
            }

            if (dataobj.code.length == 0) {
                layer.msg("验证码不能为空");
                return;
            }

            _apipost("/api/spider/user/Login", true, JSON.stringify(dataobj), function (code, obj) {
                if (code == 200) {
                    localStorage.setItem("webtoken", obj.token);
                    layer.msg("登录成功", { time: 1500 }, function () {
                        window.parent.location.replace("/page/index.html");
                    });
                }else{
                    _loadImage();
                }
            });
        }

    </script>
</body>

</html>